package com.cash.channel.api.util;

import java.util.regex.Pattern;

/**
 * Created by chengbingzheng on 2019/4/29.
 */
public class ValidatorUtil {

    /**
     * 手机号格式验证
     *
     * @param mobile
     * @return
     */
    public static boolean isMobile(String mobile) {
        if (mobile.length() == 11 && Pattern.matches("^1[3-9]\\d{9}$", mobile)) {
            return true;
        } else {
            return false;
        }
    }

    public static boolean checkIdNo(String IDNumber) {
        String REGEX_ID_CARD = "(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)";
        return Pattern.matches(REGEX_ID_CARD, IDNumber);
    }
}
